import request from '@/utils/request'

export function getPlatform() {
  return request({
    url: '/filter/platform-list/',
    method: 'POST'
  })
}

export function getBrand(data) {
  return request({
    url: '/filter/brand-list/',
    method: 'POST',
    data
  })
}

// 商品列表，在品牌分析/商品分析
export function getShop(data) {
  return request({
    url: '/filter/shop-list/',
    method: 'POST',
    data
  })
}

// 图表分析
export function filterVisual(data) {
  return request({
    url: '/filter/visual/',
    method: 'POST',
    data
  })
}

// 图表分析加载模板
export function getVisualTemplate() {
  return request({
    url: '/filter/visual-template/',
    method: 'GET',
    params: {
      filters: {}
    }
  })
}

export function deleteVisualTemplate(data) {
  return request({
    url: '/filter/visual-template/',
    method: 'DELETE',
    params: data
  })
}

// 图表分析加载模板
export function saveVisualTemplate(data) {
  return request({
    url: '/filter/visual-template/',
    method: 'POST',
    data
  })
}

// 获取下方方块展示数据
export function getSales(data) {
  return request({
    url: '/filter/sales-list/',
    method: 'POST',
    data
  })
}

export function getServerPackages() {
  return request({
    url: '/filter/customize-script/package/',
    method: 'get'
  })
}

export function getCustomizeScriptList() {
  return request({
    url: '/filter/customize-script/',
    method: 'get'
  })
}

export function deleteCustomizeScript(data) {
  return request({
    url: '/filter/customize-script/',
    method: 'get',
    params: data
  })
}

export function runCustomizeScript(data) {
  return request({
    url: '/filter/customize-script/',
    method: 'POST',
    data
  })
}

export function saveCustomizeScript(data) {
  return request({
    url: '/filter/customize-script/save/',
    method: 'POST',
    data
  })
}
